home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / rockridge / java / threads / betaclasses / SelfishRunner.java < prev    next >
Encoding:
Text File  |  1995-11-13  |  310 b   |  19 lines

  1. class SelfishRunner extends Thread {
  2.  
  3.     public int tick = 1;
  4.     public int num;
  5.  
  6.     SelfishRunner(int num) {
  7.     this.num = num;
  8.     }
  9.  
  10.     public void run() {
  11.     while (tick < 400000) {
  12.         tick++;
  13.         if ((tick % 50000) == 0) {
  14.         System.out.println("Thread #" + num + ", tick = " + tick);
  15.         }
  16.     }
  17.     }
  18. }
  19.